<?php

/**
 * PageStats form base class.
 *
 * @method PageStats getObject() Returns the current form's model object
 *
 * @package    faceshop
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePageStatsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'page_id'                       => new sfWidgetFormInputHidden(),
      'views'                         => new sfWidgetFormInputText(),
      'likes'                         => new sfWidgetFormInputText(),
      'admin_views'                   => new sfWidgetFormInputText(),
      'apply_form_count'              => new sfWidgetFormInputText(),
      'apply_url_count'               => new sfWidgetFormInputText(),
      'apply_email_count'             => new sfWidgetFormInputText(),
      'apply_spontaneous_form_count'  => new sfWidgetFormInputText(),
      'apply_spontaneous_url_count'   => new sfWidgetFormInputText(),
      'apply_spontaneous_email_count' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'page_id'                       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('page_id')), 'empty_value' => $this->getObject()->get('page_id'), 'required' => false)),
      'views'                         => new sfValidatorInteger(array('required' => false)),
      'likes'                         => new sfValidatorInteger(array('required' => false)),
      'admin_views'                   => new sfValidatorInteger(array('required' => false)),
      'apply_form_count'              => new sfValidatorInteger(array('required' => false)),
      'apply_url_count'               => new sfValidatorInteger(array('required' => false)),
      'apply_email_count'             => new sfValidatorInteger(array('required' => false)),
      'apply_spontaneous_form_count'  => new sfValidatorInteger(array('required' => false)),
      'apply_spontaneous_url_count'   => new sfValidatorInteger(array('required' => false)),
      'apply_spontaneous_email_count' => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('page_stats[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'PageStats';
  }

}
